package com.ygp.lock;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

@Slf4j(topic = "c.BiasLock")
public class BiasLock {
    static final MyLock lock = new MyLock();

    public static void main(String[] args) {
        new Thread(BiasLock::method1, "t1").start();
    }

    public static void method1() {
        log.debug("加锁前：");
        log.debug(ClassLayout.parseInstance(lock).toPrintable());
        synchronized (lock) {
            log.debug("加锁：");
            log.debug(ClassLayout.parseInstance(lock).toPrintable());
        }
        log.debug("释放锁：");
        log.debug(ClassLayout.parseInstance(lock).toPrintable());
    }
}
